package com.define.commons.demo.service.impl;

import com.define.commons.dao.service.impl.BaseServiceImpl;
import com.define.commons.demo.dao.TeacherDao;
import com.define.commons.demo.domain.Teacher;
import com.define.commons.demo.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * @Author xiewenlong
 * @Date 2018/11/14 15:50
 */
@Service
public class TeacherServiceImpl extends BaseServiceImpl<Teacher, Long> implements TeacherService {

    @Autowired
    private TeacherDao dao;

    @Override
    public Teacher full() {
        return dao.full();
    }
    
    @CacheEvict(value = CACHE_NAME,key="t.id")
    @Override
    public int update(Teacher t) {
    	return super.update(t);
    }
    
    @CacheEvict(value = CACHE_NAME,key="i")
    @Override
    public int deleteById(Long i) {
    	return super.deleteById(i);
    }
    
    @Cacheable(value = CACHE_NAME ,key= "#i")
    @Override
    public Teacher getById(Long i) {
    	return super.getById(i);
    }
}
